package com.pds.web.testOrganization.controller;


import com.pds.common.core.controller.BaseController;
import com.pds.common.core.domain.R;
import com.pds.common.core.page.TableDataInfo;
import com.pds.web.testOrganization.domain.PdsTestOrganizationHonor;
import com.pds.web.testOrganization.service.IPdsTestOrganizationHonorService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api
@RestController
@RequestMapping("/honor")
public class PdsTestOrganizationHonorController extends BaseController {

    @Autowired
    private IPdsTestOrganizationHonorService pdsTestOrganizationHonorService;

    /**
     * 新增
     *
     * @param pdsTestOrganizationHonor
     * @return
     */

    @PostMapping("/add")
    public R<PdsTestOrganizationHonor> add(@RequestBody PdsTestOrganizationHonor pdsTestOrganizationHonor) {

        return R.ok(pdsTestOrganizationHonorService.addHonor(pdsTestOrganizationHonor));
    }

    /**
     * 删除 -- 根据ID
     *
     * @param id
     * @return
     */

    @DeleteMapping("/delete")
    public R<Boolean> delete(@RequestParam Long id) {
        return R.ok(pdsTestOrganizationHonorService.deleteHonor(id));
    }

    /**
     * 更新
     *
     * @param pdsTestOrganizationHonor
     * @return
     */

    @PutMapping("/update")
    public R<Boolean> update(@RequestBody PdsTestOrganizationHonor pdsTestOrganizationHonor) {

        return R.ok(pdsTestOrganizationHonorService.updateHonor(pdsTestOrganizationHonor));
    }

    /**
     * 查询
     * @param pdsTestOrganizationHonor
     * @return
     */

    @GetMapping("/list")
    public TableDataInfo list(PdsTestOrganizationHonor pdsTestOrganizationHonor){
        startPage();
        List<PdsTestOrganizationHonor> list = pdsTestOrganizationHonorService.selectHonorlist(pdsTestOrganizationHonor);
        return getDataTable(list);
    }
}
